package cn.fl.risk.service.impl;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.Pager;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.enums.RiskCheckTypEnum;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.project.condition.PrjCstAccInfoQueryCondition;
import cn.fl.project.condition.PrjCstBscInfoQueryCondition;
import cn.fl.project.condition.PrjPrdBscInfoQueryCondition;
import cn.fl.project.condition.PrjPrdDtlQueryCondition;
import cn.fl.project.constant.PrjBscInfoConstant;
import cn.fl.project.constant.PrjCstBscInfoConstant;
import cn.fl.project.dto.PrjBscInfoDTO;
import cn.fl.project.dto.PrjCstBscInfoDTO;
import cn.fl.project.service.IPrjCstAccInfoService;
import cn.fl.project.service.IPrjPrdBscInfoService;
import cn.fl.project.service.IPrjPrdDtlService;
import cn.fl.project.service.IProjectApiService;
import cn.fl.project.vo.PrjCstAccInfoVO;
import cn.fl.project.vo.PrjPrdBscInfoVO;
import cn.fl.project.vo.PrjPrdDtlVO;
import cn.fl.risk.api.IRskCstSignLogApiService;
import cn.fl.risk.api.IRskTelSignLogApiService;
import cn.fl.risk.condition.RskCstSignLogQueryCondition;
import cn.fl.risk.condition.RskPrdSignLogQueryCondition;
import cn.fl.risk.condition.RskTelSignLogQC;
import cn.fl.risk.constant.RiskCstSignLogConstant;
import cn.fl.risk.dto.RskCstSignLogDTO;
import cn.fl.risk.dto.RskTelSignLogDTO;
import cn.fl.risk.service.IRskCstSignLogService;
import cn.fl.risk.service.IRskPrdSignLogService;
import cn.fl.risk.transform.RskCstSignLogVOTransform;
import cn.fl.risk.vo.RskCstSignLogVO;
import cn.fl.risk.vo.RskPrdSignLogVO;
import com.alibaba.fastjson.JSON;
import fl.customer.facade.customer.api.ICustomerApiService;
import fl.customer.facade.customer.condition.CstBscInfoQueryCondition;
import fl.customer.facade.customer.constant.CustomerConstant;
import fl.customer.facade.customer.dto.CstBscInfoDTO;
import fl.customer.facade.customer.dto.CstCorpBscInfoDTO;
import fl.customer.facade.customer.dto.CstNpBscInfoDTO;
import fl.spl.facade.framework.enums.SplRelLogBizTypCdNum;
import fl.spl.facade.lnkcomp.api.IPrjLnkCompQueryApiService;
import fl.spl.facade.lnkcomp.condition.PrjLnkCompQueryCondition;
import fl.spl.facade.lnkcomp.dto.PrjLnkCompDTO;
import fl.spl.facade.spl.api.ISplInfoApiService;
import fl.spl.facade.spl.condition.SplInfoQueryCondition;
import fl.spl.facade.spl.dto.SplInfoDTO;
import org.apache.commons.collections.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * @Description: 客户风险标记记录表 客户端服务层接口实现
 * 业务层方法名称前缀：
 * 新增：add*
 * 删除：remove*
 * 修改：modify*
 * 批量：batch*
 * 查询对象：select* get*
 * 查询集合：search*
 */
@Service
public class RskCstSignLogServiceImpl implements IRskCstSignLogService {

	/**
     * 日志
     */
    @SuppressWarnings("unused")
    private static final Logger logger = LoggerFactory.getLogger(RskCstSignLogServiceImpl.class);

	/**
	 * 客户风险标记记录表 暴露服务
	 */
	@Autowired
	private IRskCstSignLogApiService rskCstSignLogApiService;
	/**
     * 数据字典服务
     */
    @Autowired
    private ISysDictionaryApiService sysDictionaryApiService;

	/**
	 * 客户信息服务
	 */
	@Autowired
	private ICustomerApiService iCustomerApiService;

	@Autowired
	private IRskPrdSignLogService rskPrdSignLogService;

	@Autowired
	private IProjectApiService projectApiService;

	@Autowired
	private IPrjCstAccInfoService prjCstAccInfoService;

	/**
	 * 项目产品明细 服务层BEAN
	 */
	@Autowired
	private IPrjPrdDtlService prjPrdDtlService;

	@Autowired
	private IPrjPrdBscInfoService prjPrdBscInfoService;

	@Autowired
	private IRskTelSignLogApiService rskTelSignLogApiService;

	@Autowired
	private IPrjLnkCompQueryApiService prjLnkCompQueryApiService;

	@Autowired
	private ISplInfoApiService splInfoApiService;

	@Override
	public RskCstSignLogVO selectById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)) return null;
		RskCstSignLogDTO dto = this.rskCstSignLogApiService.selectRskCstSignLogById(id);
		RskCstSignLogVO vo= RskCstSignLogVOTransform.toVO(dto);
		setDictDataSingle(vo);
		return vo;
	}

	@Override
	public Long add(RskCstSignLogVO entity) throws BaseException{
		if(null == entity) return null;
		return this.rskCstSignLogApiService.addRskCstSignLog(RskCstSignLogVOTransform.toDTO(entity));
	}

	@Override
	public boolean removeByIds(List<Long> ids) throws BaseException{
		if(CollectionUtils.isEmpty(ids)) return false;
		return this.rskCstSignLogApiService.removeRskCstSignLogByIds(ids, CurrentThreadContext.getCurrentUserId());
	}

	@Override
	public boolean modify(RskCstSignLogVO entity) throws BaseException{
		if(null == entity) return false;
		return this.rskCstSignLogApiService.modifyRskCstSignLog(RskCstSignLogVOTransform.toDTO(entity));
	}

	@Override
	public Pager searchListPage(Pager page) throws BaseException{
        RskCstSignLogQueryCondition condition=null;
        if(null == page) {
            page = new Pager();
            page.setCondition(new RskCstSignLogQueryCondition());
        }
		condition=(RskCstSignLogQueryCondition)page.getCondition();
        condition.setSysCd(CurrentThreadContext.getCurrentSysCd());//当前系统代码
        condition.setOrgCd(CurrentThreadContext.getCurrentOrgCd());//当前机构代码
        condition.setUsrId(CurrentThreadContext.getCurrentUserId());//当前用户ID
		page=this.rskCstSignLogApiService.searchRskCstSignLogListPage(page);
		if(CollectionUtils.isNotEmpty(page.getResultList())){
            List<RskCstSignLogVO> voList=RskCstSignLogVOTransform.toVOList((List<RskCstSignLogDTO>)page.getResultList());
            this.setDictData(voList);
            page.setResultList(voList);
        }
        return page;
	}

	@Override
	public List<RskCstSignLogVO> searchList(RskCstSignLogQueryCondition condition) throws BaseException{
		if(null == condition) condition=new RskCstSignLogQueryCondition();
		condition.setSysCd(CurrentThreadContext.getCurrentSysCd());//当前系统代码
		condition.setOrgCd(CurrentThreadContext.getCurrentOrgCd());//当前机构代码
		condition.setUsrId(CurrentThreadContext.getCurrentUserId());//当前用户ID
		List<RskCstSignLogVO> voList=RskCstSignLogVOTransform.toVOList(this.rskCstSignLogApiService.searchRskCstSignLogList(condition));
		this.setDictData(voList);
		return voList;
	}

    /**
     * 添加数据字典名称
     * @param voList
     */
	public void setDictData(List<RskCstSignLogVO> voList){
		if(CollectionUtils.isEmpty(voList)) return;
		/**
		 * 客户风险标记原因
		 */
		Map<String, String> resCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CUST_RISK_REASON);
		/**
		 * 风险标记类型
		 */
		Map<String, String> resTypeMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_GRP_NM_SIGN_RES_TYPE);
		/**
		 * 客户风险标记客户类型
		 */
		Map<String, String> typeCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CST_RISK_TYPE_CD);
		/**
		 * 风险来源
		 */
		Map<String, String> sourceMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CST_RISK_SING_SOURCE);
		for(RskCstSignLogVO vo:voList){
			if (StringUtils.isNotEmpty(vo.getSignResCd()) && resCdMap != null && resCdMap.containsKey(vo.getSignResCd())) {
				vo.setSignResCdNm(resCdMap.get(vo.getSignResCd()));
			}
			if (StringUtils.isNotEmpty(vo.getSignResType()) && resTypeMap != null && resTypeMap.containsKey(vo.getSignResType())) {
				vo.setSignResTypeNm(resTypeMap.get(vo.getSignResType()));
			}
			if (StringUtils.isNotEmpty(vo.getCstTypeCd()) && typeCdMap != null) {
				String[] cstTypeCdStr = vo.getCstTypeCd().split(";");
				StringBuffer cstTypeCdNm = null;
				for(int i = 0 ; i< cstTypeCdStr.length ; i++){
					if(typeCdMap.containsKey(cstTypeCdStr[i])){
						if(null == cstTypeCdNm){
							cstTypeCdNm = new StringBuffer(typeCdMap.get(cstTypeCdStr[i]));
						}else{
							cstTypeCdNm.append("、").append(typeCdMap.get(cstTypeCdStr[i]));
						}
					}
				}
				if(null != cstTypeCdNm){
					vo.setCstTypeCdNm(cstTypeCdNm.toString());
				}
			}
			if (StringUtils.isNotEmpty(vo.getSignSource()) && sourceMap != null && sourceMap.containsKey(vo.getSignSource())) {
				vo.setSignSourceNm(sourceMap.get(vo.getSignSource()));
			}
		}
	}

	/**
	 * 添加数据字典名称
	 * @param vo
	 */
	public void setDictDataSingle(RskCstSignLogVO vo){
		if(vo == null) return;
		/**
		 * 客户风险标记原因
		 */
		Map<String, String> resCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CUST_RISK_REASON);
		/**
		 * 风险标记类型
		 */
		Map<String, String> resTypeMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_GRP_NM_SIGN_RES_TYPE);
		/**
		 * 客户风险标记客户类型
		 */
		Map<String, String> typeCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CST_RISK_TYPE_CD);
		/**
		 * 风险来源
		 */
		Map<String, String> sourceMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CST_RISK_SING_SOURCE);
		if (StringUtils.isNotEmpty(vo.getSignResCd()) && resCdMap != null && resCdMap.containsKey(vo.getSignResCd())) {
			vo.setSignResCdNm(resCdMap.get(vo.getSignResCd()));
		}
		if (StringUtils.isNotEmpty(vo.getSignResType()) && resTypeMap != null && resTypeMap.containsKey(vo.getSignResType())) {
			vo.setSignResTypeNm(resTypeMap.get(vo.getSignResType()));
		}
		if (StringUtils.isNotEmpty(vo.getCstTypeCd()) && typeCdMap != null) {
			String[] cstTypeCdStr = vo.getCstTypeCd().split(";");
			StringBuffer cstTypeCdNm = null;
			for(int i = 0 ; i< cstTypeCdStr.length ; i++){
				if(typeCdMap.containsKey(cstTypeCdStr[i])){
					if(null == cstTypeCdNm){
						cstTypeCdNm = new StringBuffer(typeCdMap.get(cstTypeCdStr[i]));
					}else{
						cstTypeCdNm.append("、").append(typeCdMap.get(cstTypeCdStr[i]));
					}
				}
			}
			vo.setCstTypeCdNm(cstTypeCdNm.toString());
		}
		if (StringUtils.isNotEmpty(vo.getSignSource()) && sourceMap != null && sourceMap.containsKey(vo.getSignSource())) {
			vo.setSignSourceNm(sourceMap.get(vo.getSignSource()));
		}
	}

	/**
     * 查询数据字典
     * @param groupCd 组代码
     * @return List<KeyValueVO>
     */
    public List<KeyValueVO> searchCdList(String groupCd){
        return this.sysDictionaryApiService.getKvList(groupCd, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
    }

	/**
	 * 单条数据删除
	 * @param id
	 * @return
	 */
	@Override
	public Boolean removeById(Long id) {
		if (id == null) {
			BaseLogUtils.info(logger, "removeById", "删除客户证件记录表信息失败,客户证件记录表对象参数为空.DATA:" + id, CurrentThreadContext.getCurrentUserName());
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, BaseExceptionConstant.BASE_EXCEPTION_CODE_600_NAME);
		}
		return this.rskCstSignLogApiService.removeById(id);
	}

	/**
	 * 修改客户表的风险字段
	 * @param cstBscInfoDTO
	 * @return
	 */
	@Override
	public boolean modifyCstRskInfo(CstBscInfoDTO cstBscInfoDTO) throws BaseException{
		return iCustomerApiService.modifyCstBscInfo(cstBscInfoDTO);
	}
	@Override
	public List<RskCstSignLogVO> searchGuarRskList(RskCstSignLogQueryCondition cstQc) {
		 List<RskCstSignLogVO> voList= RskCstSignLogVOTransform.toVOList(rskCstSignLogApiService.searchGuarRskList(cstQc));
			this.setDictData(voList);
			return voList;
	}

	@Override
	public Map<String, String> searchRskResInfo(Long cstId, Long prjId, List<Long> dtlIdList) throws BaseException{
		BaseLogUtils.newLogger("获取风险标识汇总数据,请求参数:cstId:{},prjId:{},dtlIdList", cstId, prjId, JSON.toJSONString(dtlIdList)).info();
		Map<String, String> result = new HashMap<String, String>();

		String rskCstSignDesc = "";//客户风险标记
		String rskGuarSignDesc = "";//客户风险标记(担保人)
		String rskProdSignDesc = "";//设备风险标记
		String rskCstMpSignDesc = "";//承租人手机号
		String rskVinSignDesc = "";//vin
		String rskSplSignDesc = "";//供应商
		String rskLnkSignDesc = "";//挂靠公司
		/*String rskSts = BaseConstant.IS_YESNO_NO_STR;//审批控制状态(默认不控制)*/

		List<String> rskCstList  = new ArrayList<String>();//客户风险标记
		Map<String, List<String>> map = new HashMap<String, List<String>> ();//客户风险标记(担保人)
//		Map<String, List<RskPrdSignLogVO>> rskPrdMap = new HashMap<String, List<RskPrdSignLogVO>>();//设备风险标记
		Map<String, List<String>> prdRskMap = new HashMap<>();
		Map<String, List<String>> vinRskMap = new HashMap<>();
		Map<String, List<String>> cstMpRskMap = new HashMap<>();
		Map<String, List<String>> lnkRskMap = new HashMap<>();
		Map<String, List<String>> splRskMap = new HashMap<>();
		List<Long> prjPrdDtlIdList = new ArrayList<>();
		List<String> vinList = new ArrayList<>();
		// 承租人手机号 客户信息表 项目客户账户信息表
		List<String> cstMpList = new ArrayList<>();
		List<Long> splIdList = new ArrayList<>();
		List<Long> lnkIdList = new ArrayList<>();
        try {
			// 查询项目信息
			BaseLogUtils.newLogger("searchRskResInfo,获取项目信息Start,prjId:{}", prjId).info();
			PrjBscInfoDTO prjBscInfoDTO = this.projectApiService.selectById(prjId, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
			BaseLogUtils.newLogger("searchRskResInfo,获取项目信息End,prjId:{},prjBscInfoDTO:{}", prjId, JSON.toJSONString(prjBscInfoDTO)).info();
			Map<String, String> signResTypMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), prjBscInfoDTO.getCstMgrOrgCd(), DictionaryConstant.CODE_GRP_NM_SIGN_RES_TYPE);
			Map<String, String> signResCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), prjBscInfoDTO.getCstMgrOrgCd(), DictionaryConstant.CUST_RISK_REASON);
			// 查询担保人
			PrjCstBscInfoQueryCondition prjCstBscInfoQC = new PrjCstBscInfoQueryCondition();
			prjCstBscInfoQC.setPrjId(prjId);
			prjCstBscInfoQC.setCstRlTyp(PrjCstBscInfoConstant.CST_Rl_ATTR_GUARANTOR);
			BaseLogUtils.newLogger("searchRskResInfo,获取项目担保人信息Start,prjId:{},prjCstBscInfoQC:{}", prjId, JSON.toJSONString(prjCstBscInfoQC)).info();
			List<PrjCstBscInfoDTO> prjCstBscInfoDTOList = this.projectApiService.searchPrjCstBscInfoList(prjCstBscInfoQC, CurrentThreadContext.getCurrentSysCd(), prjBscInfoDTO.getCstMgrOrgCd());
			BaseLogUtils.newLogger("searchRskResInfo,获取项目担保人信息End,prjId:{},prjCstBscInfoDTOList:{}", prjId, JSON.toJSONString(prjCstBscInfoDTOList)).info();
			List<Long> cstIdList = new ArrayList<>();
			cstIdList.add(cstId);
			for (PrjCstBscInfoDTO prjCstBscInfoDTO : prjCstBscInfoDTOList) {
				if (StringUtils.isNotEmpty(prjCstBscInfoDTO.getCstId()) && !cstIdList.contains(prjCstBscInfoDTO.getCstId())) {
					cstIdList.add(prjCstBscInfoDTO.getCstId());
				}
			}
			BaseLogUtils.newLogger("searchRskResInfo,需校验的客户,prjId:{},cstIdList:{}", prjId, JSON.toJSONString(cstIdList)).info();
			for (Long cstIds : cstIdList) {
				BaseLogUtils.newLogger("searchRskResInfo,获取项目客户信息Start,prjId:{},cstIds:{}", prjId, cstIds).info();
				CstBscInfoDTO cstBscInfoDTO = this.iCustomerApiService.selectCstBscInfoById(cstIds, prjBscInfoDTO.getBuOrgCd());
				BaseLogUtils.newLogger("searchRskResInfo,获取项目客户信息Start,prjId:{},cstIds:{},cstBscInfoDTO:{}", prjId, cstIds, JSON.toJSONString(cstBscInfoDTO)).info();
				RskCstSignLogQueryCondition rskCstSignLogQC = null;
				if (null != cstBscInfoDTO) {
					rskCstSignLogQC = new RskCstSignLogQueryCondition();
					rskCstSignLogQC.setCstId(cstIds);
					rskCstSignLogQC.setCstNm(cstBscInfoDTO.getCstNm());
					rskCstSignLogQC.setSignSource(RiskCheckTypEnum.RISK_SOURCE_CST.key);
					rskCstSignLogQC.setCstTypeCd(RiskCstSignLogConstant.CODE_GRP_NM_CST_RISK_TYPE_CD_1);
					if (!Objects.equals(cstIds, cstId)) {
						// 担保人
						rskCstSignLogQC.setCstTypeCd(RiskCstSignLogConstant.CODE_GRP_NM_CST_RISK_TYPE_CD_7);
					}
					rskCstSignLogQC.setIsDel(BaseConstant.IS_YESNO_NO);
					rskCstSignLogQC.setIsValid(BaseConstant.IS_YESNO_YES);
					rskCstSignLogQC.setIsNew(BaseConstant.IS_YESNO_YES);
//					rskCstSignLogQC.setSignResType(RiskCstSignLogConstant.CODE_GRP_NM_SIGN_RES_TYPE_3);
					if (CustomerConstant.CST_TYP_CD_NP.equals(cstBscInfoDTO.getCstTypCd())) {
						if (DictionaryConstant.CODE_CERT_TYP_CD_0.equals(cstBscInfoDTO.getCertTypCd()) && StringUtils.isNotBlank(cstBscInfoDTO.getCertNo())) {
							rskCstSignLogQC.setCstIdcard(cstBscInfoDTO.getCertNo());
						}
						String mp = cstBscInfoDTO.getMp1();
						CstNpBscInfoDTO cstNpBscInfoDTO = cstBscInfoDTO.getCstNpBscInfoDTO();
						String mp1 = cstNpBscInfoDTO.getMp1();
						String mp2 = cstNpBscInfoDTO.getMp2();
						if (Objects.equals(cstIds, cstId)) {
							// 客户
							if (StringUtils.isNotBlank(mp) && (CollectionUtils.isEmpty(cstMpList) || !cstMpList.contains(mp))) {
								cstMpList.add(mp);

							}
							if (StringUtils.isNotBlank(mp1) && (CollectionUtils.isEmpty(cstMpList) || !cstMpList.contains(mp1))) {
								cstMpList.add(mp1);

							}
							if (StringUtils.isNotBlank(mp2) && (CollectionUtils.isEmpty(cstMpList) || !cstMpList.contains(mp2))) {
								cstMpList.add(mp2);

							}
						}
					}
					if (CustomerConstant.CST_TYP_CD_CORP.equals(cstBscInfoDTO.getCstTypCd())) {
						// 社会统一信用代码
						if (DictionaryConstant.CODE_CERT_TYP_CD_91.equals(cstBscInfoDTO.getCertTypCd()) && StringUtils.isNotBlank(cstBscInfoDTO.getCertNo())) {
							rskCstSignLogQC.setCstIdcard(cstBscInfoDTO.getCertNo());
						} else {
							BaseLogUtils.newLogger("searchRskResInfo,获取法人客户信息Start,prjId:{},cstIds:{}", prjId, cstIds).info();
							CstCorpBscInfoDTO cstCorpBscInfoDTO = this.iCustomerApiService.selectCstCorpBscInfoDTOById(cstIds);
							BaseLogUtils.newLogger("searchRskResInfo,获取法人客户信息End,prjId:{},cstCorpBscInfoDTO:{}", prjId, JSON.toJSONString(cstCorpBscInfoDTO)).info();
							if (StringUtils.isNotBlank(cstCorpBscInfoDTO.getSucc())) {
								rskCstSignLogQC.setCstIdcard(cstCorpBscInfoDTO.getSucc());
							}
						}

					}
				}
				BaseLogUtils.newLogger("searchRskResInfo,获取客户风险标记Start,prjId:{},cstIds:{},rskCstSignLogQC:{}", prjId, cstIds, JSON.toJSONString(rskCstSignLogQC)).info();
				if (null != rskCstSignLogQC) {
					List<RskCstSignLogDTO> rskCstSignLogDTOList = this.rskCstSignLogApiService.searchRskCstSignLogList(rskCstSignLogQC);
					BaseLogUtils.newLogger("searchRskResInfo,获取客户风险标记End,prjId:{},cstIds:{},rskCstSignLogDTOList:{}", prjId, cstIds, JSON.toJSONString(rskCstSignLogDTOList)).info();
					if (CollectionUtils.isNotEmpty(rskCstSignLogDTOList)) {
						for (RskCstSignLogDTO rskCstSignLogDTO : rskCstSignLogDTOList) {
							String signResType = rskCstSignLogDTO.getSignResType();
							String signResCd = rskCstSignLogDTO.getSignResCd();
							if (!Objects.equals(cstIds, cstId)) {
								if (map.containsKey(rskCstSignLogDTO.getCstNm())) {
									List<String> cstSignResCdList = map.get(rskCstSignLogDTO.getCstNm());
									if (StringUtils.isBlank(signResCd)) {
										String signResTypNm = this.getSignResTypNm(signResTypMap, signResType);
										if (!cstSignResCdList.contains(signResTypNm)) {
											cstSignResCdList.add(signResTypNm);
											map.put(rskCstSignLogDTO.getCstNm(), cstSignResCdList);
										}
									} else {
										String signResCdNm = this.getSignResCdNm(signResCdMap, signResCd);
										if (!cstSignResCdList.contains(signResCdNm)) {
											cstSignResCdList.add(signResCdNm);
											map.put(rskCstSignLogDTO.getCstNm(), cstSignResCdList);
										}
									}
								} else {
									List<String> cstSignResCdList = new ArrayList<>();
									if (StringUtils.isBlank(signResCd)) {
										cstSignResCdList.add(this.getSignResTypNm(signResTypMap, signResType));
									} else {
										cstSignResCdList.add(this.getSignResCdNm(signResCdMap, signResCd));
									}
									map.put(rskCstSignLogDTO.getCstNm(), cstSignResCdList);
								}
							} else {
								// 承租人
								if (StringUtils.isBlank(signResCd)) {
									String signResTypNm = this.getSignResTypNm(signResTypMap, signResType);
									if (!rskCstList.contains(signResTypNm)) {
										rskCstList.add(signResTypNm);
									}
								} else {
									String signResCdNm = this.getSignResCdNm(signResCdMap, signResCd);
									if (!rskCstList.contains(signResCdNm)) {
										rskCstList.add(signResCdNm);
									}
								}

							}
						}
					}
				}

			}
//			BaseLogUtils.newLogger("searchRskResInfo,获取客户风险标记结果,prjId:{},cstId:{},rskCstList:{},map:{}", prjId, cstId, JSON.toJSONString(rskCstList), JSON.toJSONString(map)).info();
//			rskCstList = this.setSignResCdNm(rskCstList, CurrentThreadContext.getCurrentSysCd(), prjBscInfoDTO.getCstMgrOrgCd());
			BaseLogUtils.newLogger("searchRskResInfo,获取客户风险标记处理结果,prjId:{},cstId:{},rskCstList:{}", prjId, cstId, JSON.toJSONString(rskCstList)).info();
			if (CollectionUtils.isNotEmpty(rskCstList)) {
				rskCstSignDesc = StringUtils.join(rskCstList, ",");
			}
			if (MapUtils.isNotEmpty(map)) {
				List<String> rskGuarList = new ArrayList<>();
				for (Map.Entry<String, List<String>> entry : map.entrySet()) {
//					List<String> rskGuarLogList = this.setSignResCdNm(entry.getValue(), CurrentThreadContext.getCurrentSysCd(), prjBscInfoDTO.getCstMgrOrgCd());
					rskGuarList.add(entry.getKey() + ":" + StringUtils.join(entry.getValue(), ","));
				}
				if (CollectionUtils.isNotEmpty(rskGuarList)) {
					rskGuarSignDesc = StringUtils.join(rskGuarList, ",");
				}
			}
			BaseLogUtils.newLogger("searchRskResInfo,获取客户风险标记处理结果,prjId:{},cstId:{},map:{},rskGuarSignDesc:{}", prjId, cstId, JSON.toJSONString(map), rskGuarSignDesc).info();
//			//根据项目id查询客户风险标记
//            RskCstSignLogQueryCondition rskCstQc = new RskCstSignLogQueryCondition();
//            rskCstQc.setCstId(cstId);
//            List<RskCstSignLogVO> rskCstSignLogList = this.searchList(rskCstQc);
//            BaseLogUtils.info(logger,"searchRskResInfo","获取风险标识汇总数据.客户风险标记查询结果：" + JSON.toJSONString(rskCstSignLogList));
//            if(CollectionUtils.isNotEmpty(rskCstSignLogList)){
//                for(int i=0;i<rskCstSignLogList.size();i++){
//                    RskCstSignLogVO rskCstSignLogVO =rskCstSignLogList.get(i);
//                    if(!rskCstList.contains(rskCstSignLogVO.getSignResCdNm())){
//                        rskCstList.add(rskCstSignLogVO.getSignResCdNm());
//                    }
//                }
//                for(int j=0;j<rskCstList.size();j++){
//                    if(j==rskCstList.size()-1){
//                        rskCstSignDesc+= rskCstList.get(j);
//                    }else{
//                        rskCstSignDesc+= rskCstList.get(j)+",";
//                    }
//                }
//            }
//            BaseLogUtils.info(logger,"searchRskResInfo","获取风险标识汇总数据.客户风险标记处理结果：" + rskCstSignDesc);
//            //担保人风险标记
//            RskCstSignLogQueryCondition cstQc = new RskCstSignLogQueryCondition();
//            cstQc.setPrjId(prjId);
//            List<RskCstSignLogVO>  cstGuarList = this.searchGuarRskList(cstQc);
//            BaseLogUtils.info(logger,"searchRskResInfo","获取风险标识汇总数据.客户风险标记(担保人)查询结果：" + JSON.toJSONString(rskCstSignLogList));
//            if(CollectionUtils.isNotEmpty(cstGuarList)){
//                for (RskCstSignLogVO rskCstSignLogVO : cstGuarList) {
//                    if(!map.containsKey(rskCstSignLogVO.getCstNm())){
//                        List<String> guarList = new ArrayList<String>();
//                        guarList.add(rskCstSignLogVO.getSignResCdNm());
//                        map.put(rskCstSignLogVO.getCstNm(), guarList);
//                    }else{
//                        map.get(rskCstSignLogVO.getCstNm()).add(rskCstSignLogVO.getSignResCdNm());
//                    }
//                }
//                for (Map.Entry<String, List<String>> entry : map.entrySet()) {
//                    List<String> rskGuarLogList = entry.getValue();
//                    rskGuarSignDesc +="  ";
//                    rskGuarSignDesc +=entry.getKey()+":";
//                    for(int i=0;i<rskGuarLogList.size();i++){
//                        String desc =rskGuarLogList.get(i);
//                        if(StringUtils.isNotBlank(desc)){
//                            if(i==rskGuarLogList.size()-1){
//                                rskGuarSignDesc+=desc;
//                            }else{
//                                rskGuarSignDesc+=desc+",";
//                            }
//                        }
//                    }
//                }
//            }
//            BaseLogUtils.info(logger,"searchRskResInfo","获取风险标识汇总数据.客户风险标记(担保人)处理结果：" + rskGuarSignDesc);
			// 查询项目供应商
			PrjPrdBscInfoQueryCondition prjPrdBscInfoQC = new PrjPrdBscInfoQueryCondition();
			prjPrdBscInfoQC.setPrjId(prjId);
			prjPrdBscInfoQC.setIsDel(BaseConstant.IS_YESNO_NO);
			BaseLogUtils.newLogger("searchRskResInfo,获取项目信息Start,prjId:{},prjPrdBscInfoQC:{}", prjId, JSON.toJSONString(prjPrdBscInfoQC)).info();
			List<PrjPrdBscInfoVO> prjPrdBscInfoVOList = this.prjPrdBscInfoService.searchList(prjPrdBscInfoQC);
			BaseLogUtils.newLogger("searchRskResInfo,获取项目信息End,prjId:{},prjPrdBscInfoVOList:{}", prjId, JSON.toJSONString(prjPrdBscInfoVOList)).info();
            // 设备 vin 风险标记
			BaseLogUtils.newLogger("searchRskResInfo,项目产品明细id集合,prjId:{},dtlIdList:{}", prjId, JSON.toJSONString(dtlIdList)).info();
            if(CollectionUtils.isNotEmpty(dtlIdList)){
				PrjPrdDtlQueryCondition prjPrdDtlQC = new PrjPrdDtlQueryCondition();
				prjPrdDtlQC.setIdList(dtlIdList);
				prjPrdDtlQC.setIsDel(BaseConstant.IS_YESNO_NO);
				BaseLogUtils.newLogger("searchRskResInfo,获取项目产品明细信息Start,prjId:{},prjPrdDtlQC:{}", prjId, JSON.toJSONString(prjPrdDtlQC)).info();
				List<PrjPrdDtlVO> prjPrdDtlVOList = this.prjPrdDtlService.selectList(prjPrdDtlQC);
				BaseLogUtils.newLogger("searchRskResInfo,获取项目产品明细信息End,prjId:{},prjPrdDtlVOList:{}", prjId, JSON.toJSONString(prjPrdDtlVOList)).info();
				List<Long> prdDtlIdList = new ArrayList<>();
				if (CollectionUtils.isNotEmpty(prjPrdDtlVOList)) {
					for (PrjPrdDtlVO prjPrdDtlVO : prjPrdDtlVOList) {
						if (StringUtils.isNotEmpty(prjPrdDtlVO.getLnkCompId()) && (CollectionUtils.isEmpty(lnkIdList) || !lnkIdList.contains(prjPrdDtlVO.getLnkCompId()))) {
							lnkIdList.add(prjPrdDtlVO.getLnkCompId());
						}
						if (StringUtils.isNotEmpty(prjPrdDtlVO.getPrdDtlId()) && (CollectionUtils.isEmpty(prdDtlIdList) || !prdDtlIdList.contains(prjPrdDtlVO.getPrdDtlId()))) {
							prdDtlIdList.add(prjPrdDtlVO.getPrdDtlId());
						}
						if (StringUtils.isBlank(prjPrdDtlVO.getVin())) {
							continue;
						}
						if (CollectionUtils.isEmpty(prjPrdDtlIdList) || !prjPrdDtlIdList.contains(prjPrdDtlVO.getId())) {
							prjPrdDtlIdList.add(prjPrdDtlVO.getId());
						}
						if (CollectionUtils.isEmpty(vinList) || !vinList.contains(prjPrdDtlVO.getVin())) {
							vinList.add(prjPrdDtlVO.getVin());
						}
					}
				}
				if (CollectionUtils.isNotEmpty(prjPrdBscInfoVOList)) {
					for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOList) {
						if (CollectionUtils.isNotEmpty(prdDtlIdList) && StringUtils.isNotEmpty(prjPrdBscInfoVO.getPrdDtlId()) && prdDtlIdList.contains(prjPrdBscInfoVO.getPrdDtlId())) {
							if (StringUtils.isNotEmpty(prjPrdBscInfoVO.getSplId()) && (CollectionUtils.isEmpty(splIdList) || !splIdList.contains(prjPrdBscInfoVO.getSplId()))) {
								splIdList.add(prjPrdBscInfoVO.getSplId());
							}
						}
					}
					if (CollectionUtils.isEmpty(splIdList)) {
						for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOList) {
							if (StringUtils.isNotEmpty(prjPrdBscInfoVO.getSplId()) && (CollectionUtils.isEmpty(splIdList) || !splIdList.contains(prjPrdBscInfoVO.getSplId()))) {
								splIdList.add(prjPrdBscInfoVO.getSplId());
							}
						}
					}
				}
				if (CollectionUtils.isNotEmpty(prjPrdDtlIdList)) {
					RskPrdSignLogQueryCondition rskPrdQc = new RskPrdSignLogQueryCondition();
					rskPrdQc.setPrjPrdDtlIdList(prjPrdDtlIdList);
					BaseLogUtils.newLogger("searchRskResInfo,获取设备风险标记End,prjId:{},rskPrdQc:{}", prjId, JSON.toJSONString(rskPrdQc)).info();
					List<RskPrdSignLogVO> rskPrdSignLogList = this.rskPrdSignLogService.searchList(rskPrdQc);
					BaseLogUtils.newLogger("searchRskResInfo,获取设备风险标记End,prjId:{},rskPrdSignLogList:{}", prjId, JSON.toJSONString(rskPrdSignLogList)).info();
					if(CollectionUtils.isNotEmpty(rskPrdSignLogList)){
//						for (RskPrdSignLogVO rskPrdSignLogVO : rskPrdSignLogList) {
//							if(!rskPrdMap.containsKey(rskPrdSignLogVO.getVin())){
//								List<RskPrdSignLogVO> rskPrdList = new ArrayList<RskPrdSignLogVO>();
//								rskPrdList.add(rskPrdSignLogVO);
//								rskPrdMap.put(rskPrdSignLogVO.getVin(), rskPrdList);
//							}else{
//								rskPrdMap.get(rskPrdSignLogVO.getVin()).add(rskPrdSignLogVO);
//							}
//						}
//						if(rskPrdMap.keySet().size()>1){
//							for (Map.Entry<String, List<RskPrdSignLogVO>> entry : rskPrdMap.entrySet()) {
//								List<RskPrdSignLogVO> rskPrdLogList = entry.getValue();
//								rskProdSignDesc +="  ";
//								rskProdSignDesc +=entry.getKey()+":";
//								for(int i=0;i<rskPrdLogList.size();i++){
//									RskPrdSignLogVO rskPrdSignLogVO =rskPrdSignLogList.get(i);
//									if(i==rskPrdSignLogList.size()-1){
//										rskProdSignDesc+=rskPrdSignLogVO.getSignResCdNam();
//									}else{
//										rskProdSignDesc+=rskPrdSignLogVO.getSignResCdNam()+",";
//									}
//								}
//							}
//						}else{
//							rskProdSignDesc +=rskPrdSignLogList.get(0).getVin()+":"+rskPrdSignLogList.get(0).getSignResCdNam();
//						}
						rskProdSignDesc = getRskPrdSignLogString(rskPrdSignLogList, prdRskMap);
					}
				}
				if (CollectionUtils.isNotEmpty(vinList)) {
					List<RskPrdSignLogVO> rskVinSignLogs = new ArrayList<>();
					for (String vin : vinList) {
						RskPrdSignLogQueryCondition rskVinQc = new RskPrdSignLogQueryCondition();
						rskVinQc.setVin(vin);
						BaseLogUtils.newLogger("searchRskResInfo,获取vin风险标记Start,prjId:{},rskVinQc:{}", prjId, JSON.toJSONString(rskVinQc)).info();
						List<RskPrdSignLogVO> rskVinSignLogList = this.rskPrdSignLogService.searchList(rskVinQc);
						BaseLogUtils.newLogger("searchRskResInfo,获取vin风险标记End,prjId:{},rskPrdSignLogList:{}", prjId, JSON.toJSONString(rskVinSignLogList)).info();
						if (CollectionUtils.isNotEmpty(rskVinSignLogList)) {
							rskVinSignLogs.addAll(rskVinSignLogList);
						}
					}
					rskVinSignDesc = getRskPrdSignLogString(rskVinSignLogs, vinRskMap);
				}
            }
			BaseLogUtils.newLogger("searchRskResInfo,获取设备风险标记,设备风险标记处理结果,prjId:{},rskProdSignDesc:{}", prjId, rskProdSignDesc).info();
			BaseLogUtils.newLogger("searchRskResInfo,获取设备风险标记,vin风险标记处理结果,prjId:{},rskVinSignDesc:{}", prjId, rskVinSignDesc).info();
            /*//审批控制状态(标记灰名单或黑名单,只能驳回或不通过操作)  判断客户标记、设备标记 有一个命中 即命中规则
            RskCstSignLogQueryCondition rskCstSignLogQueryCondition = new RskCstSignLogQueryCondition();
            List<String> signResTypeList = new ArrayList<String>();
            signResTypeList.add(RiskCstSignLogConstant.CODE_GRP_NM_SIGN_RES_TYPE_2);//灰名单
            signResTypeList.add(RiskCstSignLogConstant.CODE_GRP_NM_SIGN_RES_TYPE_3);//黑名单
            rskCstSignLogQueryCondition.setSignResTypeList(signResTypeList);
            List<RskCstSignLogVO> rskCstSignLogVOList = this.searchList(rskCstSignLogQueryCondition);
            BaseLogUtils.info(logger,"searchRskResInfo","获取风险标识汇总数据.审批控制状态.客户风险标记结果：" + JSON.toJSONString(rskCstSignLogVOList));
            if(CollectionUtils.isNotEmpty(rskCstSignLogVOList)){
                rskSts = BaseConstant.IS_YESNO_YES_STR;//命中
            }else{
                RskPrdSignLogQueryCondition rskPrdSignLogQueryCondition = new RskPrdSignLogQueryCondition();
                rskPrdSignLogQueryCondition.setSignResTypeList(signResTypeList);
                List<RskPrdSignLogVO> rskPrdSignLogVOList = this.rskPrdSignLogService.searchList(rskPrdSignLogQueryCondition);
                BaseLogUtils.info(logger,"searchRskResInfo","获取风险标识汇总数据.审批控制状态.设备风险标记结果：" + JSON.toJSONString(rskPrdSignLogVOList));
                if(CollectionUtils.isNotEmpty(rskPrdSignLogVOList)){
                    rskSts = BaseConstant.IS_YESNO_YES_STR;//命中
                }
            }
            BaseLogUtils.info(logger,"searchRskResInfo","获取风险标识汇总数据.审批控制状态处理结果：" + rskSts);*/
            // 承租人手机号
			PrjCstAccInfoQueryCondition prjCstAccInfoQC = new PrjCstAccInfoQueryCondition();
			prjCstAccInfoQC.setPrjId(prjId);
			prjCstAccInfoQC.setCstId(cstId);
			prjCstAccInfoQC.setIsDel(BaseConstant.IS_YESNO_NO);
			BaseLogUtils.newLogger("searchRskResInfo,获取项目客户账户信息Start,prjId:{},prjCstAccInfoQC:{}", prjId, JSON.toJSONString(prjCstAccInfoQC)).info();
			List<PrjCstAccInfoVO> prjCstAccInfoVOList = this.prjCstAccInfoService.searchList(prjCstAccInfoQC);
			BaseLogUtils.newLogger("searchRskResInfo,获取项目客户账户信息End,prjId:{},prjCstAccInfoVOList:{}", prjId, JSON.toJSONString(prjCstAccInfoVOList)).info();
			if (CollectionUtils.isNotEmpty(prjCstAccInfoVOList)) {
				for (PrjCstAccInfoVO prjCstAccInfoVO : prjCstAccInfoVOList) {
					String mp = prjCstAccInfoVO.getMp();
					if (StringUtils.isBlank(mp) && (CollectionUtils.isEmpty(cstMpList) || !cstMpList.contains(mp))) {
						cstMpList.add(mp);
					}
				}
			}
			BaseLogUtils.newLogger("searchRskResInfo,承租人手机号集合,prjId:{},cstMpList:{}", prjId, JSON.toJSONString(cstMpList)).info();
			if (CollectionUtils.isNotEmpty(cstMpList)) {
				RskTelSignLogQC rskTelSignLogQC = new RskTelSignLogQC();
				rskTelSignLogQC.setTelList(cstMpList);
				rskTelSignLogQC.setIsDel(BaseConstant.IS_YESNO_NO);
				rskTelSignLogQC.setIsNew(BaseConstant.IS_YESNO_YES);
				rskTelSignLogQC.setIsValid(BaseConstant.IS_YESNO_YES);
				BaseLogUtils.newLogger("searchRskResInfo,获取手机号风险标记Start,prjId:{},rskTelSignLogQC:{}", prjId, JSON.toJSONString(rskTelSignLogQC)).info();
				List<RskTelSignLogDTO> rskTelSignLogDTOList = this.rskTelSignLogApiService.searchList(rskTelSignLogQC);
				BaseLogUtils.newLogger("searchRskResInfo,获取手机号风险标记End,prjId:{},rskTelSignLogDTOList:{}", prjId, JSON.toJSONString(rskTelSignLogDTOList)).info();
				if (CollectionUtils.isNotEmpty(rskTelSignLogDTOList)) {
					Map<String, Map<String, String>> dealMpMap = new HashMap<>();
					for (RskTelSignLogDTO rskTelSignLogDTO : rskTelSignLogDTOList) {
						String tel = rskTelSignLogDTO.getTel();
						String signRes = rskTelSignLogDTO.getSignRes();
						String signResType = rskTelSignLogDTO.getSignResType();
						if (StringUtils.isBlank(tel) || StringUtils.isBlank(signResType)) {
							continue;
						}
//						if (MapUtils.isEmpty(cstMpRskMap) || !cstMpRskMap.containsKey(tel)) {
//							List<String> signResList = new ArrayList<>();
//							if (StringUtils.isBlank(signRes)) {
//								signResList.add(this.getSignResTypNm(signResTypMap, signResType));
//							} else {
//								signResList.add(this.getSignResCdNm(signResCdMap, signRes));
//							}
//							cstMpRskMap.put(tel, signResList);
//						} else {
//							List<String> signResList = cstMpRskMap.get(tel);
//							if (StringUtils.isBlank(signRes)) {
//								String signResTypNm = this.getSignResTypNm(signResTypMap, signResType);
//								if (!signResList.contains(signResTypNm)) {
//									signResList.add(signResTypNm);
//									cstMpRskMap.put(tel, signResList);
//								}
//							} else {
//								String signResCdNm = this.getSignResCdNm(signResCdMap, signRes);
//								if (!signResList.contains(signResCdNm)) {
//									signResList.add(signResCdNm);
//									cstMpRskMap.put(tel, signResList);
//								}
//							}
//
//						}
						//todo
						String signResTypNm = this.getSignResTypNm(signResTypMap, signResType);
//						String signResCdNm = this.getSignResCdNm(signResCdMap, signRes);
						if (StringUtils.isBlank(signResTypNm)) {
							continue;
						}
						if (MapUtils.isEmpty(dealMpMap) || !dealMpMap.containsKey(tel)) {
							Map<String, String> mpMap = new HashMap<>();
							mpMap.put(signResTypNm, signRes);
							dealMpMap.put(tel, mpMap);
						} else {
							Map<String, String> mpMap = dealMpMap.get(tel);
							if (!mpMap.containsKey(signResTypNm)) {
								mpMap.put(signResTypNm, signRes);
							} else {
								String oldSignResCdNm = mpMap.get(signResTypNm);
								if (StringUtils.isBlank(oldSignResCdNm)) {
									if (StringUtils.isNotBlank(signRes)) {
										oldSignResCdNm = signRes;
									}
								} else {
									if (StringUtils.isNotBlank(signRes) && !oldSignResCdNm.contains(signRes)) {
										oldSignResCdNm = oldSignResCdNm + "." + signRes;
									}
								}
								mpMap.put(signResTypNm, oldSignResCdNm);
							}
							dealMpMap.put(tel, mpMap);
						}

					}
//					if (MapUtils.isNotEmpty(cstMpRskMap)) {
//						StringBuffer cstMpSb = new StringBuffer();
//						for (Map.Entry<String, List<String>> entry : cstMpRskMap.entrySet()) {
//							List<String> value = entry.getValue();
//							// 字典
////							List signResCdNmList = this.setSignResCdNm(value, CurrentThreadContext.getCurrentSysCd(), prjBscInfoDTO.getCstMgrOrgCd());
//							cstMpSb.append(entry.getKey()).append(":").append(StringUtils.join(value, ",")).append(";");
//						}
//						rskCstMpSignDesc = cstMpSb.toString();
//					}

					if (MapUtils.isNotEmpty(dealMpMap)) {
						StringBuffer cstMpSb = new StringBuffer();
						for (Map.Entry<String, Map<String, String>> entry : dealMpMap.entrySet()) {
							String cstNm = entry.getKey();
							Map<String, String> value = entry.getValue();
							for (Map.Entry<String, String> valueEntry : value.entrySet()) {
								String signResTypeNm = valueEntry.getKey();
								String signResCdNam = valueEntry.getValue();
								cstMpSb.append(cstNm).append(":").append(signResTypeNm);
								if (StringUtils.isNotBlank(signResCdNam)) {
									cstMpSb.append("-").append(signResCdNam);
								}
								cstMpSb.append(";");
							}
						}
						rskCstMpSignDesc = cstMpSb.toString();
					}


				}
			}
			BaseLogUtils.newLogger("searchRskResInfo,获取设备风险标记,承租人手机号风险标记处理结果,prjId:{},rskCstMpSignDesc:{}", prjId, rskCstMpSignDesc).info();
			// 挂靠公司
			BaseLogUtils.newLogger("searchRskResInfo,挂靠公司id集合,prjId:{},lnkIdList:{}", prjId, JSON.toJSONString(lnkIdList)).info();
			if (CollectionUtils.isNotEmpty(lnkIdList)) {
				// 原来按照事业部page/qc查询的方法 区别在于是否分页/传入orgCd的字典封装-不传默认0000
//				List<PrjLnkCompDTO> prjLnkCompDTOS = new ArrayList<>();
				PrjLnkCompQueryCondition prjLinkQC = new PrjLnkCompQueryCondition();
				prjLinkQC.setIdList(lnkIdList);
				prjLinkQC.setIsBlackList(9);
				if (PrjBscInfoConstant.CODE_BU_ORG_CD_QCJR.equals(prjBscInfoDTO.getBuOrgCd())) {
					prjLinkQC.setOrgCd(prjBscInfoDTO.getCstMgrOrgCd());
				}
				BaseLogUtils.newLogger("searchRskResInfo,查询挂靠公司信息Start,prjId:{},prjLinkQC:{}", prjId, JSON.toJSONString(prjLinkQC)).info();
				List<PrjLnkCompDTO> prjLnkCompDTOList = this.prjLnkCompQueryApiService.getPrjLnkCompByCondition(prjLinkQC);
				BaseLogUtils.newLogger("searchRskResInfo,查询挂靠公司信息End,prjId:{},prjLnkCompDTOList:{}", prjId, JSON.toJSONString(prjLnkCompDTOList)).info();
//				if (CollectionUtils.isNotEmpty(prjLnkCompDTOList)) {
//					prjLnkCompDTOList.addAll(prjLnkCompDTOList);
//				}
//				if (!PrjBscInfoConstant.CODE_BU_ORG_CD_QCJR.equals(prjBscInfoDTO.getBuOrgCd())) {
//					Pager page = new Pager();
//					page.setCurrentPage(1);
//					page.setEveryPage(Integer.MAX_VALUE);
//					PrjLnkCompQueryCondition qc = new PrjLnkCompQueryCondition();
//					qc.setIdList(lnkIdList);
//					page.setCondition(qc);
//					BaseLogUtils.newLogger("searchRskResInfo,查询挂靠公司信息1Start,prjId:{},page:{}", prjId, JSON.toJSONString(page)).info();
//					Pager pager = this.prjLnkCompQueryApiService.searchPrjLnkCompListPage(page, CurrentThreadContext.getCurrentSysCd(), prjBscInfoDTO.getCstMgrOrgCd());
//					BaseLogUtils.newLogger("searchRskResInfo,查询挂靠公司信息1End,prjId:{},pager:{}", prjId, JSON.toJSONString(pager)).info();
//					@SuppressWarnings("unchecked")
//					List<PrjLnkCompDTO> lnkCompList = (List<PrjLnkCompDTO>)pager.getResultList();
//					if (CollectionUtils.isNotEmpty(lnkCompList)) {
//						prjLnkCompDTOS.addAll(lnkCompList);
//					}
//				} else {
//					PrjLnkCompQueryCondition prjLinkQC = new PrjLnkCompQueryCondition();
//					prjLinkQC.setIdList(lnkIdList);
//					prjLinkQC.setOrgCd(prjBscInfoDTO.getCstMgrOrgCd());
//					BaseLogUtils.newLogger("searchRskResInfo,查询挂靠公司信息2Start,prjId:{},prjLinkQC:{}", prjId, JSON.toJSONString(prjLinkQC)).info();
//					List<PrjLnkCompDTO> prjLnkCompDTOList = this.prjLnkCompQueryApiService.getPrjLnkCompByCondition(prjLinkQC);
//					BaseLogUtils.newLogger("searchRskResInfo,查询挂靠公司信息2End,prjId:{},prjLnkCompDTOList:{}", prjId, JSON.toJSONString(prjLnkCompDTOList)).info();
//					if (CollectionUtils.isNotEmpty(prjLnkCompDTOList)) {
//						prjLnkCompDTOS.addAll(prjLnkCompDTOList);
//					}
//				}
				BaseLogUtils.newLogger("searchRskResInfo,需要处理的挂靠公司集合,prjId:{},prjLnkCompDTOList:{}", prjId, JSON.toJSONString(prjLnkCompDTOList)).info();
				if (CollectionUtils.isNotEmpty(prjLnkCompDTOList)) {
					List<RskCstSignLogDTO> rskCstSignLogDTOs = new ArrayList<>();
					RskCstSignLogQueryCondition rskCstSignLogQC = null;
					for (PrjLnkCompDTO prjLnkCompDTO : prjLnkCompDTOList) {
						rskCstSignLogQC = new RskCstSignLogQueryCondition();
						rskCstSignLogQC.setCstId(prjLnkCompDTO.getId());
						rskCstSignLogQC.setCstNm(prjLnkCompDTO.getLnkCompNm());
						rskCstSignLogQC.setSignSource(RiskCheckTypEnum.RISK_SOURCE_LNK.key);
						rskCstSignLogQC.setCstTypeCd(RiskCstSignLogConstant.CODE_GRP_NM_CST_RISK_TYPE_CD_3);
						rskCstSignLogQC.setIsDel(BaseConstant.IS_YESNO_NO);
						rskCstSignLogQC.setIsValid(BaseConstant.IS_YESNO_YES);
						rskCstSignLogQC.setIsNew(BaseConstant.IS_YESNO_YES);
						rskCstSignLogQC.setCstIdcard(prjLnkCompDTO.getSucc());
						BaseLogUtils.newLogger("searchRskResInfo,获取挂靠公司风险标记Start,prjId:{},rskCstSignLogQC:{}", prjId, JSON.toJSONString(rskCstSignLogQC)).info();
						List<RskCstSignLogDTO> rskCstSignLogDTOList = this.rskCstSignLogApiService.searchRskCstSignLogList(rskCstSignLogQC);
						BaseLogUtils.newLogger("searchRskResInfo,获取挂靠公司风险标记End,prjId:{},rskCstSignLogDTOList:{}", prjId, JSON.toJSONString(rskCstSignLogDTOList)).info();
						if (CollectionUtils.isNotEmpty(rskCstSignLogDTOList)) {
							rskCstSignLogDTOs.addAll(rskCstSignLogDTOList);
						}
					}
					BaseLogUtils.newLogger("searchRskResInfo,需要提示的挂靠公司集合,prjId:{},rskCstSignLogDTOs:{}", prjId, JSON.toJSONString(rskCstSignLogDTOs)).info();
					rskLnkSignDesc = this.getRskCstSignLogString(rskCstSignLogDTOs, lnkRskMap, prjBscInfoDTO, signResCdMap, signResTypMap);
				}
			}
			BaseLogUtils.newLogger("searchRskResInfo,获取设备风险标记,挂靠公司风险标记处理结果,prjId:{},rskLnkSignDesc:{}", prjId, rskLnkSignDesc).info();
			// 供应商
			BaseLogUtils.newLogger("searchRskResInfo,供应商id集合,prjId:{},splIdList:{}", prjId, JSON.toJSONString(splIdList)).info();
			if (CollectionUtils.isNotEmpty(splIdList)) {
				SplInfoQueryCondition splQC = new SplInfoQueryCondition();
				splQC.setIds(splIdList);
				splQC.setIsBlackList(9);
				splQC.setIsDel(BaseConstant.IS_YESNO_NO);
				BaseLogUtils.newLogger("searchRskResInfo,查询项目产品供应商信息Start,prjId:{},splQC:{}", prjId, JSON.toJSONString(splQC)).info();
				List<SplInfoDTO> splInfoDTOList = this.splInfoApiService.searchSplInfoList(splQC, CurrentThreadContext.getCurrentSysCd(), prjBscInfoDTO.getCstMgrOrgCd());
				BaseLogUtils.newLogger("searchRskResInfo,查询项目产品供应商信息End,prjId:{},splInfoDTOList:{}", prjId, JSON.toJSONString(splInfoDTOList)).info();
				if (CollectionUtils.isNotEmpty(splInfoDTOList)) {
					List<RskCstSignLogDTO> rskCstSignLogDTOs = new ArrayList<>();
					RskCstSignLogQueryCondition rskCstSignLogQC = null;
					for (SplInfoDTO splInfoDTO : splInfoDTOList) {
						rskCstSignLogQC = new RskCstSignLogQueryCondition();
						rskCstSignLogQC.setCstId(splInfoDTO.getId());
						rskCstSignLogQC.setCstNm(splInfoDTO.getSplNm());
						rskCstSignLogQC.setSignSource(RiskCheckTypEnum.RISK_SOURCE_SPL.key);
						rskCstSignLogQC.setCstTypeCd(RiskCstSignLogConstant.CODE_GRP_NM_CST_RISK_TYPE_CD_2);
						rskCstSignLogQC.setIsDel(BaseConstant.IS_YESNO_NO);
						rskCstSignLogQC.setIsValid(BaseConstant.IS_YESNO_YES);
						rskCstSignLogQC.setIsNew(BaseConstant.IS_YESNO_YES);
						rskCstSignLogQC.setCstIdcard(splInfoDTO.getSucc());
						BaseLogUtils.newLogger("searchRskResInfo,获取供应商风险标记Start,prjId:{},rskCstSignLogQC:{}", prjId, JSON.toJSONString(rskCstSignLogQC)).info();
						List<RskCstSignLogDTO> rskCstSignLogDTOList = this.rskCstSignLogApiService.searchRskCstSignLogList(rskCstSignLogQC);
						BaseLogUtils.newLogger("searchRskResInfo,获取供应商风险标记End,prjId:{},rskCstSignLogDTOList:{}", prjId, JSON.toJSONString(rskCstSignLogDTOList)).info();
						if (CollectionUtils.isNotEmpty(rskCstSignLogDTOList)) {
							rskCstSignLogDTOs.addAll(rskCstSignLogDTOList);
						}
					}
					BaseLogUtils.newLogger("searchRskResInfo,需要提示的供应商集合,prjId:{},rskCstSignLogDTOs:{}", prjId, JSON.toJSONString(rskCstSignLogDTOs)).info();
					rskSplSignDesc = this.getRskCstSignLogString(rskCstSignLogDTOs, splRskMap, prjBscInfoDTO, signResCdMap, signResTypMap);
				}
			}
			BaseLogUtils.newLogger("searchRskResInfo,获取设备风险标记,供应商风险标记处理结果,prjId:{},rskSplSignDesc:{}", prjId, rskSplSignDesc).info();
			result.put("rskCstSignDesc",rskCstSignDesc);
            result.put("rskGuarSignDesc",rskGuarSignDesc);
            result.put("rskProdSignDesc",rskProdSignDesc);
			result.put("rskVinSignDesc",rskVinSignDesc);
			result.put("rskCstMpSignDesc",rskCstMpSignDesc);
			result.put("rskLnkSignDesc",rskLnkSignDesc);
			result.put("rskSplSignDesc",rskSplSignDesc);
            /*result.put("rskSts",rskSts);*/
        } catch (BaseException e) {
			BaseLogUtils.newLogger("获取风险标识汇总数据,处理异常:cstId:{},prjId:{},e:{}", cstId, prjId, e.getMessage()).info();
        } catch (Exception e) {
			BaseLogUtils.newLogger("获取风险标识汇总数据,系统异常:cstId:{},prjId:{},e:{}", cstId, prjId, e.getMessage()).setThrowable(e).error(LogExceptionEnum.COMMON_CODE_0002);
        }
		BaseLogUtils.newLogger("获取风险标识汇总数据,处理结果:cstId:{},prjId:{},result:{}", cstId, prjId, JSON.toJSONString(result)).info();
		return result;
	}

	/**
	 * 项目产品 vin 风险标记原因处理
	 * @param rskPrdSignLogVOList
	 * @param rskPrdSignLogMap
	 * @return
	 * @throws BaseException
	 */
	private String getRskPrdSignLogString(List<RskPrdSignLogVO> rskPrdSignLogVOList, Map<String, List<String>> rskPrdSignLogMap) throws BaseException {
		String rskPrdSignLog = "";
		if (CollectionUtils.isNotEmpty(rskPrdSignLogVOList)) {
			Map<String, Map<String, String>> dealMap = new HashMap<>();
			for (RskPrdSignLogVO rskPrdSignLogVO : rskPrdSignLogVOList) {
				String vin = rskPrdSignLogVO.getVin();
				String signResCdNam = rskPrdSignLogVO.getSignResCdNam();
				String signResTypeNm = rskPrdSignLogVO.getSignResTypeNm();
				if (StringUtils.isBlank(vin) || StringUtils.isBlank(signResTypeNm)) {
					continue;
				}
//				if (MapUtils.isEmpty(rskPrdSignLogMap) || !rskPrdSignLogMap.containsKey(vin)) {
//					List<String> rskSignResCdNam = new ArrayList<>();
//					rskSignResCdNam.add(signResCdNam);
//					rskPrdSignLogMap.put(vin, rskSignResCdNam);
//				} else {
//					List<String> rskSignResCdNam = rskPrdSignLogMap.get(vin);
//					if (!rskSignResCdNam.contains(signResCdNam)) {
//						rskSignResCdNam.add(signResCdNam);
//						rskPrdSignLogMap.put(vin, rskSignResCdNam);
//					}
//				}
				if (MapUtils.isEmpty(dealMap) || !dealMap.containsKey(vin)) {
					Map<String, String> map = new HashMap<>();
					map.put(signResTypeNm, signResCdNam);
					dealMap.put(vin, map);
				} else {
					Map<String, String> map = dealMap.get(vin);
					if (!map.containsKey(signResTypeNm)) {
						map.put(signResTypeNm, signResCdNam);
					} else {
						String oldSignResCdNm = map.get(signResTypeNm);
						if (StringUtils.isBlank(oldSignResCdNm)) {
							if (StringUtils.isNotBlank(signResCdNam)) {
								oldSignResCdNm = signResCdNam;
							}
						} else {
							if (StringUtils.isNotBlank(signResCdNam) && !oldSignResCdNm.contains(signResCdNam)) {
								oldSignResCdNm = oldSignResCdNm + "." + signResCdNam;
							}
						}
						map.put(signResTypeNm, oldSignResCdNm);
					}
					dealMap.put(vin, map);
				}
			}
//			if (MapUtils.isNotEmpty(rskPrdSignLogMap)) {
//				StringBuffer prdSb = new StringBuffer();
//				for (Map.Entry<String, List<String>> entry : rskPrdSignLogMap.entrySet()) {
//					prdSb.append(entry.getKey()).append(":").append(StringUtils.join(entry.getValue(), ",")).append(";");
//				}
//				rskPrdSignLog = prdSb.toString();
//			}
			if (MapUtils.isNotEmpty(dealMap)) {
				StringBuffer prdSb = new StringBuffer();
				for (Map.Entry<String, Map<String, String>> entry : dealMap.entrySet()) {
					String vin = entry.getKey();
					Map<String, String> value = entry.getValue();
					for (Map.Entry<String, String> valueEntry : value.entrySet()) {
						String signResTypeNm = valueEntry.getKey();
						String signResCdNam = valueEntry.getValue();
						prdSb.append(vin).append(":").append(signResTypeNm);
						if (StringUtils.isNotBlank(signResCdNam)) {
							prdSb.append("-").append(signResCdNam);
						}
						prdSb.append(";");
					}
				}
				rskPrdSignLog = prdSb.toString();
			}
		}
		return rskPrdSignLog;
	}

	/**
	 * 供应商 挂靠公司 风险标记原因处理
	 * @param rskCstSignLogDTOList
	 * @param rskCstSignLogMap
	 * @param prjBscInfoDTO
	 * @return
	 * @throws BaseException
	 */
	private String getRskCstSignLogString(List<RskCstSignLogDTO> rskCstSignLogDTOList, Map<String, List<String>> rskCstSignLogMap, PrjBscInfoDTO prjBscInfoDTO, Map<String, String> signResCdMap, Map<String, String> signResTypMap) throws BaseException {
		String rskCstSignLog = "";
		if (CollectionUtils.isNotEmpty(rskCstSignLogDTOList)) {
			Map<String, Map<String, String>> dealMap = new HashMap<>();
			for (RskCstSignLogDTO rskCstSignLogDTO : rskCstSignLogDTOList) {
				String cstNm = rskCstSignLogDTO.getCstNm();
				String signResCd = rskCstSignLogDTO.getSignResCd();
				String signResType = rskCstSignLogDTO.getSignResType();
				if (StringUtils.isBlank(cstNm) || StringUtils.isBlank(signResType)) {
					continue;
				}
//				if (MapUtils.isEmpty(rskCstSignLogMap) || !rskCstSignLogMap.containsKey(cstNm)) {
//					List<String> rskSignResCd = new ArrayList<>();
//					if (StringUtils.isBlank(signResCd)) {
//						rskSignResCd.add(this.getSignResTypNm(signResTypMap, signResType));
//					} else {
//						rskSignResCd.add(this.getSignResCdNm(signResCdMap, signResCd));
//					}
//
//					rskCstSignLogMap.put(cstNm, rskSignResCd);
//				} else {
//					List<String> rskSignResCd = rskCstSignLogMap.get(cstNm);
//					if (StringUtils.isBlank(signResCd)) {
//						String signResTypNm = this.getSignResTypNm(signResTypMap, signResType);
//						if (!rskSignResCd.contains(signResTypNm)) {
//							rskSignResCd.add(signResTypNm);
//							rskCstSignLogMap.put(cstNm, rskSignResCd);
//						}
//					} else {
//						String signResCdNm = this.getSignResCdNm(signResCdMap, signResCd);
//						if (!rskSignResCd.contains(signResCdNm)) {
//							rskSignResCd.add(signResCdNm);
//							rskCstSignLogMap.put(cstNm, rskSignResCd);
//						}
//					}
//
//				}
				String signResTypNm = this.getSignResTypNm(signResTypMap, signResType);
				String signResCdNm = this.getSignResCdNm(signResCdMap, signResCd);
				if (StringUtils.isBlank(signResTypNm)) {
					continue;
				}
				if (MapUtils.isEmpty(dealMap) || !dealMap.containsKey(cstNm)) {
					Map<String, String> map = new HashMap<>();
					map.put(signResTypNm, signResCdNm);
					dealMap.put(cstNm, map);
				} else {
					Map<String, String> map = dealMap.get(cstNm);
					if (!map.containsKey(signResTypNm)) {
						map.put(signResTypNm, signResCdNm);
					} else {
						String oldSignResCdNm = map.get(signResTypNm);
						if (StringUtils.isBlank(oldSignResCdNm)) {
							if (StringUtils.isNotBlank(signResCdNm)) {
								oldSignResCdNm = signResCdNm;
							}
						} else {
							if (StringUtils.isNotBlank(signResCdNm) && !oldSignResCdNm.contains(signResCdNm)) {
								oldSignResCdNm = oldSignResCdNm + "." + signResCdNm;
							}
						}
						map.put(signResTypNm, oldSignResCdNm);
					}
					dealMap.put(cstNm, map);
				}


			}
//			if (MapUtils.isNotEmpty(rskCstSignLogMap)) {
//				StringBuffer splSb = new StringBuffer();
//				for (Map.Entry<String, List<String>> entry : rskCstSignLogMap.entrySet()) {
//					List<String> value = entry.getValue();
//					// 字典
////					List signResCdNmList = this.setSignResCdNm(value, CurrentThreadContext.getCurrentSysCd(), prjBscInfoDTO.getCstMgrOrgCd());
//					splSb.append(entry.getKey()).append(":").append(StringUtils.join(value, ",")).append(";");
//				}
//				rskCstSignLog = splSb.toString();
//			}
			if (MapUtils.isNotEmpty(dealMap)) {
				StringBuffer rskSb = new StringBuffer();
				for (Map.Entry<String, Map<String, String>> entry : dealMap.entrySet()) {
					String cstNm = entry.getKey();
					Map<String, String> value = entry.getValue();
					for (Map.Entry<String, String> valueEntry : value.entrySet()) {
						String signResTypeNm = valueEntry.getKey();
						String signResCdNam = valueEntry.getValue();
						rskSb.append(cstNm).append(":").append(signResTypeNm);
						if (StringUtils.isNotBlank(signResCdNam)) {
							rskSb.append("-").append(signResCdNam);
						}
						rskSb.append(";");
					}
				}
				rskCstSignLog = rskSb.toString();
			}


		}
		return rskCstSignLog;
	}

	@Override
	public DataResultDTO searchRskSts(Long cstId, List<Long> dtlIdList) throws BaseException {
		return this.rskCstSignLogApiService.searchRskStsForFlow(cstId,dtlIdList);
	}

    @Override
    public DataResultDTO checkIsRecordMain(Long id) throws BaseException {
	    DataResultDTO resultDTO = new DataResultDTO(BaseConstant.IS_YESNO_YES, "存在已备案主体！");
        RskCstSignLogDTO rskCstSignLogDTO = this.rskCstSignLogApiService.selectRskCstSignLogById(id);
        if (null == rskCstSignLogDTO) {
            throw new BaseException("该主体不存在风险标记记录，请添加！");
        }
        // 记录不存在客户id，可能是已备案账号
        if (StringUtils.isEmpty(rskCstSignLogDTO.getCstId())) {
            String signSource = rskCstSignLogDTO.getSignSource();
            String cstTypeCd = rskCstSignLogDTO.getCstTypeCd();
            String cstIdcard = rskCstSignLogDTO.getCstIdcard();
            switch (signSource) {
                case "CST":
                    if (cstTypeCd.contains(RiskCstSignLogConstant.CODE_GRP_NM_CST_RISK_TYPE_CD_1) || cstTypeCd.contains(RiskCstSignLogConstant.CODE_GRP_NM_CST_RISK_TYPE_CD_6)) {
                        CstBscInfoQueryCondition cstBscInfoQueryCondition = new CstBscInfoQueryCondition();
                        cstBscInfoQueryCondition.setCertNo(cstIdcard);
                        List<CstBscInfoDTO> cstBscInfoDTOS = this.iCustomerApiService.searchCstBscInfoWithCertNo(cstBscInfoQueryCondition);
                        if (CollectionUtils.isNotEmpty(cstBscInfoDTOS)) {
                            rskCstSignLogDTO.setCstId(cstBscInfoDTOS.get(0).getId());
                            rskCstSignLogDTO.setCstNm(cstBscInfoDTOS.get(0).getCstNm());
                        }
                    }
                    break;
                case "SPL":
                    if (cstTypeCd.contains(RiskCstSignLogConstant.CODE_GRP_NM_CST_RISK_TYPE_CD_2)) {
                        SplInfoQueryCondition splInfoQueryCondition = new SplInfoQueryCondition();
                        splInfoQueryCondition.setSucc(cstIdcard);
                        splInfoQueryCondition.setIsDel(BaseConstant.IS_YESNO_NO);
                        List<SplInfoDTO> splInfoDTOS = this.splInfoApiService.searchSplInfoList(splInfoQueryCondition);
                        if (CollectionUtils.isNotEmpty(splInfoDTOS)) {
                            rskCstSignLogDTO.setCstId(splInfoDTOS.get(0).getId());
                            rskCstSignLogDTO.setCstNm(splInfoDTOS.get(0).getSplNm());
                        }
                    }
                    break;
                case "LNK":
                    if (cstTypeCd.contains(RiskCstSignLogConstant.CODE_GRP_NM_CST_RISK_TYPE_CD_2)) {
                        PrjLnkCompQueryCondition prjLnkCompQueryCondition = new PrjLnkCompQueryCondition();
                        prjLnkCompQueryCondition.setSucc(cstIdcard);
                        prjLnkCompQueryCondition.setIsDel(BaseConstant.IS_YESNO_NO);
                        List<PrjLnkCompDTO> prjLnkCompList = this.prjLnkCompQueryApiService.getPrjLnkCompByCondition(prjLnkCompQueryCondition);
                        if (CollectionUtils.isNotEmpty(prjLnkCompList)) {
                            rskCstSignLogDTO.setCstId(prjLnkCompList.get(0).getId());
                            rskCstSignLogDTO.setCstNm(prjLnkCompList.get(0).getLnkNm());
                        }
                    }
                    break;
                default:
                    break;
            }

            resultDTO.setData(rskCstSignLogDTO);
            return resultDTO;
        }

        return new DataResultDTO(BaseConstant.IS_YESNO_NO, "不存在已备案主体！");
    }


    private List<String> setSignResCdNm(List<String> signResCdList, String sysCd, String orgCd) throws BaseException {
		if (CollectionUtils.isEmpty(signResCdList)) return new ArrayList<String>();
		Map<String, String> signResCdMap = this.sysDictionaryApiService.searchGroupToMap(sysCd, orgCd, DictionaryConstant.CUST_RISK_REASON);
		List<String> signResCdNmList = new ArrayList<>();
		if (MapUtils.isNotEmpty(signResCdMap)) {
			for (String signResCd : signResCdList) {
				if (signResCdMap.containsKey(signResCd)) {
					signResCdNmList.add(signResCdMap.get(signResCd));
				}
			}
		}
		return signResCdNmList;
	}

	private String getSignResTypNm(Map<String, String> signResTypMap, String signResTyp) throws BaseException {
		String signResTypNm = "";
		if (StringUtils.isBlank(signResTyp) || MapUtils.isEmpty(signResTypMap)) {
			return signResTypNm;
		}
		for (Map.Entry<String, String> entry : signResTypMap.entrySet()) {
			if (signResTyp.equals(entry.getKey())) {
				signResTypNm = entry.getValue();
			}
		}
		return signResTypNm;
	}

	private String getSignResCdNm(Map<String, String> signResCdMap, String signResCd) throws BaseException {
		String signResCdNm = "";
		if (StringUtils.isBlank(signResCd) || MapUtils.isEmpty(signResCdMap)) {
			return signResCdNm;
		}
		for (Map.Entry<String, String> entry : signResCdMap.entrySet()) {
			if (signResCd.equals(entry.getKey())) {
				signResCdNm = entry.getValue();
			}
		}
		return signResCdNm;
	}
}
